import upload from '@/utils/upload'
import request from '@/utils/request'



// 
export function weChatAuthorizedLogin(data) {
  return request({
    url: '/wechat/energyLogin/weChatAuthorizedLogin',
    method: 'post',
	data: data
  })
}


//获取手机信息
export function getPhoneNumber(data) {
  return request({
    url: '/wechat/getPhoneNumber',
    method: 'post',
	data: data
  })
}
export function appCheck(query) {
  return request({
    url: '/app/version/check',
    method: 'get',
    params: query
  })
}
export function plotList(query) {
  return request({
    url: '/version/check',
    method: 'get',
    params: query
  })
}
// 查询站点管理详细
export function getPlot(id) {
  return request({
    url: '/wechat/plot/' + id,
    method: 'get'
  })
}
// 查询站点管理详细
export function chargingList(query) {
  return request({
    url: '/wechat/plot/chargingList',
    method: 'get',
    params: query
  })
}

// 查询充值套餐列表
export function wechatPromotionList(data) {
  return request({
    url: '/wechat/promotion/list',
    method: 'get',
	data: data
  })
}
// 充值
export function wechatPromotionRecharge(data) {
  return request({
    url: '/wechat/promotion/recharge',
    method: 'post',
	data: data
  })
}


//租户通讯录
export function getTenantContacts() {
  return request({
    url: '/lock/tenant/selectTenantContacts',
    method: 'get'
  })
}

//打卡
export function checkaInAdd(data) {
  return request({
    url: '/lock/in',
    method: 'post',
    data:data
  })
}

//可选择需要打卡的锁
export function selectCheckaInDirection(phone) {
  return request({
    url: '/lock/in/selectCheckaInDirection?phone='+phone,
    method: 'get'
  })
}

//查询打卡记录
// export function checkAInList(phone,TheDay) {
//   return request({
//     url: '/lock/in/checkAInList?phone='+phone+'&TheDay='+TheDay,
//     method: 'get'
//   })
// }

export function checkAInList(query) {
  return request({
    url: '/lock/in/checkAInList',
    method: 'get',
    params: query
  })
}

//查询十天内 打卡记录
export function checkAInListByDate(query) {
  return request({
    url: '/lock/in/checkAInListByDate',
    method: 'get',
    params: query
  })
}

//查询是否是房东
export function checkAInListByDateLandlord() {
  return request({
    url: '/lock/tenant/selectATenantByPhone',
    method: 'get',
  })
}

//解冻用户
export function wxDefrostUser(data) {
  return request({
    url: '/lock/room/jiedong2',
    method: 'get',
    params: data
  })
}

//解冻用户
export function wxhxOpenDoorLock(roomId) {
  return request({
    url: '/lock/room/wxhxOpenDoorLock?roomId='+roomId,
    method: 'get',
  })
}

//小程序用户登录后身份认证
export function authentication(data) {
  return request({
    url: '/lock/tenant/authentication',
    method: 'post',
    data: data
  })
}

//小程序身份认证信息
export function updateAuthentication(data) {
  return request({
    url: '/lock/tenant/updateAuthentication',
    method: 'put',
    data: data
  })
}

//根据手机号查租户信息
export function selectATenantByPhone() {
  return request({
    url: '/lock/tenant/selectATenantByPhone',
    method: 'get',
  })
}

//根据手机号和房间号查钥匙
export function vxSelectByPhoneUpdatepwd(query) {
  return request({
    url: '/lock/key/vxSelectByPhone',
    method: 'get',
	params: query
  })
}










// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    'url': '/login',
    headers: {
      isToken: false
    },
    'method': 'post',
    'data': data
  })
}

// 注册方法
export function register(data) {
  return request({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    'url': '/getInfo',
    'method': 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    'url': '/logout',
    'method': 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    'url': '/captchaImage',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}
